package com.baby.utils;

import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class ConnectionUtil {

    public static Connection getConnection() throws IOException, TimeoutException {
        //1.工厂
        ConnectionFactory connectionFactory =new ConnectionFactory();
        //2.设置参数
        connectionFactory.setHost("192.168.247.132");
        connectionFactory.setPort(5672);
        connectionFactory.setUsername("baby");
        connectionFactory.setPassword("123456");
        connectionFactory.setVirtualHost("scc");
        //3.获取一个对象
        Connection connection = connectionFactory.newConnection();
        return  connection;
    }

}
